<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui">

<h:head>
	<title>Cadastrar Usuário</title>
</h:head>

<body>
	<h:form id="formCadastro">
		<p:messages id="msgs" />

		<p:panel header="Cadastro de Usuários">
			<p:outputLabel value="Nome:" for="nome" />
			<br />
			<p:inputText id="nome" maxlength="255" style="width: 320px;" value="#{usuarioBean.usuario.nome}" required="true" requiredMessage="Nome é obrigatório." />
			<br />
			<br />

			<p:outputLabel value="E-mail:" for="email" />
			<br />
			<p:inputText id="email" maxlength="255" style="width: 320px;" value="#{usuarioBean.usuario.email}" required="true" requiredMessage="E-Mail é obrigatório." />
			<br />
			<br />
		</p:panel>

		<p:toolbar>
			<p:toolbarGroup align="left">
				<p:commandButton value="Home" action="index" icon="ui-icon-home" immediate="true" />
				
				<p:separator />
				
				<p:commandButton value="Salvar" actionListener="#{usuarioBean.salvar()}" icon="ui-icon-check" update="msgs,formCadastro" process="@form" />
			</p:toolbarGroup>
		</p:toolbar>
	</h:form>
	
	<p:ajaxStatus onstart="PF('statusDialog').show();" onsuccess="PF('statusDialog').hide();"/>
	<p:dialog modal="true" widgetVar="statusDialog" header="Status"   
	        draggable="false" closable="false">  
	    <p:graphicImage value="/images/ajax-loader.gif" />  
	</p:dialog>
</body>
</html>
